"""
!/usr/bin/env python
-*- coding: utf-8 -*-
@CreateTime : 2024/7/2 17:11
@Author  :    AnimateX
@Contact :    animatex@163.com
@File    :    precision_test.py
@License :    Copyright © 2024 AnimateX. All rights reserved.
@Version :    precision_test_VER0.1

------------------------------------------------------------------
# @Description:

------------------------------------------------------------------
"""
import os
import cv2
import numpy as np
from tqdm import tqdm
from natsort import natsorted
from precision_core import RMSLPrecision
from parser_cam_param import ParserCamParam
from utils import Utils


def preprocess(json_path: str, test_precision_dir: str, disp_w, disp_h, key='_depth_', en_disp=False):
    if not os.path.exists(json_path):
        print(' [ERROR] Check json file path.')
        return

    if not os.path.exists(test_precision_dir):
        print(' [ERROR] Test directory is empty')
        return
    parser = ParserCamParam(json_path)
    cam_param, ratio_w, ratio_h = parser.parser_cam_param(disp_w, disp_h)

    test_img_name_list = os.listdir(test_precision_dir)
    if en_disp:
        key = '_disp'

    img_name_list = [img_name for img_name in test_img_name_list if '.png' in img_name and '_align' not in img_name]
    img_name_list = [img_name for img_name in img_name_list if key in img_name]
    img_path_list = [os.path.join(test_precision_dir, img_name) for img_name in img_name_list]
    img_path_list = natsorted(img_path_list)

    if en_disp:
        dp_img_path_list = []
        for idx, disp_img_path in enumerate(tqdm(img_path_list, desc="Disp to Depth...", colour='cyan')):
            dp_img_path = disp_img_path.replace(key, '_depth')
            disp_img = cv2.imread(disp_img_path, cv2.IMREAD_UNCHANGED)
            dp_img = Utils().disp_to_depth(disp_img,
                                           cam_param['q_coeffs']['Q23'],
                                           cam_param['q_coeffs']['Q32'],
                                           cam_param['q_coeffs']['Q33'],
                                           sub_pixel_value=64,
                                           zoom_ratio=1.0,
                                           max_dis=3000)
            cv2.imwrite(dp_img_path, dp_img)
            dp_img_path_list.append(dp_img_path)

        return cam_param, dp_img_path_list
    else:
        return cam_param, img_path_list


def cal_precision(depth_img_path_list: list, cam_info: dict, csv_file_name: str, measureDelta=4.23):
    """

    :param depth_img_path_list:
    :param cam_info:
    :param csv_file_name:
    :param measureDelta:            ob 测量的距离实际要加上这个delta
    :return:
    """
    if len(depth_img_path_list) == 0:
        print(' [ERROR] List is empty!')
        return

    precision = RMSLPrecision()
    all_result_dict = {}

    depth_img_path_list = natsorted(depth_img_path_list)
    for idx, dp_img_path in enumerate(tqdm(depth_img_path_list, desc=' Processing (cal-precision)...', colour='green')):
        # dp_img_path = ("/home/dataset_b/rmslTestDataset/orbbec/gemini335-01/v0619/r1920x1080_d1280x800/"
        #                "precision/normal-precision/0008_indoor_white_wall_depth_200mm.png")

        dp_img_name = dp_img_path.split('/')[-1]
        measured_distance = int(dp_img_name.split('_')[-1].split('.')[0].replace('mm', ''))
        measured_distance += measureDelta
        depth_intrinsic = cam_info['depth_intrinsics']
        if depth_intrinsic is None or len(depth_intrinsic) == 0:
            depth_intrinsic = {
                'fx': 622.810913,
                'fy': 622.810913,
                'cx': 634.000000,
                'cy': 397.000000,
                'width': 1280,
                'height': 800
            }

        dp_img = Utils().readImage(dp_img_path,
                                   depth_intrinsic['width'],
                                   depth_intrinsic['height'],
                                   data_type=np.uint16,
                                   mode='depth')

        hole_rate = Utils().calculate_hole_rate(dp_img)
        if hole_rate > 0.5:
            print(f" [ERROR] Image hole rate too high: {hole_rate * 100:5.2f}%")
            continue

        # Use image center point not OpticalCenter
        abs_acc_res = precision.calMeanPrecisionByORBBECMethod(dp_img,
                                                               measured_distance,
                                                               depth_intrinsic['cx'],
                                                               depth_intrinsic['cy'],
                                                               roi_w=24,
                                                               roi_h=24,
                                                               cen_size_h=24,
                                                               cen_size_v=24,
                                                               min_ratio=0.5,
                                                               max_ratio=0.9,
                                                               en_img_cen=True,
                                                               en_precise_acc=False)

        # Use image center
        rel_acc_res = precision.calRelativePrecision(dp_img,
                                                     depth_intrinsic['fx'],
                                                     depth_intrinsic['fy'],
                                                     depth_intrinsic['cx'],
                                                     depth_intrinsic['cy'],
                                                     seed=42,
                                                     cen_size_h=24,
                                                     cen_size_v=24,
                                                     min_ratio=0.5,
                                                     max_ratio=0.9,
                                                     use_img_cen=True,
                                                     en_filter=True)

        ecovacs_abs_acc = precision.calEcovasRobotPointCloudPrecision(dp_img,
                                                                      measured_distance,
                                                                      depth_intrinsic['fx'],
                                                                      depth_intrinsic['fy'],
                                                                      depth_intrinsic['cx'],
                                                                      depth_intrinsic['cy'])

        ecovacs_rel_acc = precision.calEcovasRobotPointCloudPrecisionByFit(dp_img,
                                                                           depth_intrinsic['fx'],
                                                                           depth_intrinsic['fy'],
                                                                           depth_intrinsic['cx'],
                                                                           depth_intrinsic['cy'])

        result_dict = {'distance': (measured_distance - measureDelta), 'hole_rate': hole_rate,
                       'outlier_percent': rel_acc_res['outlier_percent'],
                       'abs_avg_roi_c': abs_acc_res['avg_roi_c'],
                       'abs_avg_roi_l': abs_acc_res['avg_roi_l'], 'abs_avg_roi_r': abs_acc_res['avg_roi_r'],
                       'abs_avg_roi_t': abs_acc_res['avg_roi_t'], 'abs_avg_roi_b': abs_acc_res['avg_roi_b'],
                       'abs_avg_roi_25': abs_acc_res['avg_roi_25'], 'abs_avg_roi_81': abs_acc_res['avg_roi_81'],
                       'abs_avg_roi_cen': abs_acc_res['avg_roi_cen'], 'abs_min_roi_c': abs_acc_res['min_roi_c'],
                       'abs_min_roi_l': abs_acc_res['min_roi_l'], 'abs_min_roi_r': abs_acc_res['min_roi_r'],
                       'abs_min_roi_t': abs_acc_res['min_roi_t'], 'abs_min_roi_b': abs_acc_res['min_roi_b'],
                       'abs_min_roi_25': abs_acc_res['min_roi_25'], 'abs_min_roi_81': abs_acc_res['min_roi_81'],
                       'abs_min_roi_cen': abs_acc_res['min_roi_cen'], 'abs_max_roi_c': abs_acc_res['max_roi_c'],
                       'abs_max_roi_l': abs_acc_res['max_roi_l'], 'abs_max_roi_r': abs_acc_res['max_roi_r'],
                       'abs_max_roi_t': abs_acc_res['max_roi_t'], 'abs_max_roi_b': abs_acc_res['max_roi_b'],
                       'abs_max_roi_25': abs_acc_res['max_roi_25'], 'abs_max_roi_81': abs_acc_res['max_roi_81'],
                       'abs_max_roi_cen': abs_acc_res['max_roi_cen'], 'abs_std_roi_c': abs_acc_res['std_roi_c'],
                       'abs_std_roi_l': abs_acc_res['std_roi_l'], 'abs_std_roi_r': abs_acc_res['std_roi_r'],
                       'abs_std_roi_t': abs_acc_res['std_roi_t'], 'abs_std_roi_b': abs_acc_res['std_roi_b'],
                       'abs_std_roi_25': abs_acc_res['std_roi_25'], 'abs_std_roi_81': abs_acc_res['std_roi_81'],
                       'abs_std_roi_cen': abs_acc_res['std_roi_cen'], 'abs_var_roi_c': abs_acc_res['var_roi_c'],
                       'abs_var_roi_l': abs_acc_res['var_roi_l'], 'abs_var_roi_r': abs_acc_res['var_roi_r'],
                       'abs_var_roi_t': abs_acc_res['var_roi_t'], 'abs_var_roi_b': abs_acc_res['var_roi_b'],
                       'abs_var_roi_25': abs_acc_res['var_roi_25'], 'abs_var_roi_81': abs_acc_res['var_roi_81'],
                       'abs_var_roi_cen': abs_acc_res['var_roi_cen'], 'rmse_roi_c': abs_acc_res['rmse_roi_c'],
                       'rmse_roi_l': abs_acc_res['rmse_roi_l'], 'rmse_roi_r': abs_acc_res['rmse_roi_r'],
                       'rmse_roi_t': abs_acc_res['rmse_roi_t'], 'rmse_roi_b': abs_acc_res['rmse_roi_b'],
                       'rmse_roi_25': abs_acc_res['rmse_roi_25'], 'rmse_roi_81': abs_acc_res['rmse_roi_81'],
                       'rmse_roi_cen': abs_acc_res['rmse_roi_cen'],
                       'rel_fov_h_val': rel_acc_res['fov_h_val'], 'rel_fov_h_max': rel_acc_res['fov_h_max'],
                       'rel_fov_h_min': rel_acc_res['fov_h_min'], 'rel_fov_h_cen': rel_acc_res['fov_h_cen'],
                       'rel_fov_v_val': rel_acc_res['fov_v_val'], 'rel_fov_v_max': rel_acc_res['fov_v_max'],
                       'rel_fov_v_min': rel_acc_res['fov_v_min'], 'rel_fov_v_cen': rel_acc_res['fov_v_cen'],
                       'rel_avg_roi_25': rel_acc_res['avg_roi_25'], 'rel_avg_roi_81': rel_acc_res['avg_roi_81'],
                       'rel_avg_roi_cen': rel_acc_res['avg_roi_cen'], 'rel_min_roi_25': rel_acc_res['min_roi_25'],
                       'rel_min_roi_81': rel_acc_res['min_roi_81'], 'rel_min_roi_cen': rel_acc_res['min_roi_cen'],
                       'rel_max_roi_25': rel_acc_res['max_roi_25'], 'rel_max_roi_81': rel_acc_res['max_roi_81'],
                       'rel_max_roi_cen': rel_acc_res['max_roi_cen'], 'rel_std_roi_25': rel_acc_res['std_roi_25'],
                       'rel_std_roi_81': rel_acc_res['std_roi_81'], 'rel_std_roi_cen': rel_acc_res['std_roi_cen'],
                       'rel_var_roi_25': rel_acc_res['var_roi_25'], 'rel_var_roi_81': rel_acc_res['var_roi_81'],
                       'rel_var_roi_cen': rel_acc_res['var_roi_cen'],
                       'rel_avg_per_roi_25': rel_acc_res['avg_per_roi_25'],
                       'rel_avg_per_roi_81': rel_acc_res['avg_per_roi_81'],
                       'rel_avg_per_roi_cen': rel_acc_res['avg_per_roi_cen'],
                       'rel_min_per_roi_25': rel_acc_res['min_per_roi_25'],
                       'rel_min_per_roi_81': rel_acc_res['min_per_roi_81'],
                       'rel_min_per_roi_cen': rel_acc_res['min_per_roi_cen'],
                       'rel_max_per_roi_25': rel_acc_res['max_per_roi_25'],
                       'rel_max_per_roi_81': rel_acc_res['max_per_roi_81'],
                       'rel_max_per_roi_cen': rel_acc_res['max_per_roi_cen'],
                       'rel_std_per_roi_25': rel_acc_res['std_per_roi_25'],
                       'rel_std_per_roi_81': rel_acc_res['std_per_roi_81'],
                       'rel_std_per_roi_cen': rel_acc_res['std_per_roi_cen'],
                       'rel_var_per_roi_25': rel_acc_res['var_per_roi_25'],
                       'rel_var_per_roi_81': rel_acc_res['var_per_roi_81'],
                       'rel_var_per_roi_cen': rel_acc_res['var_per_roi_cen'], 'abs_LU_avg': ecovacs_abs_acc['LU_avg'],
                       'abs_CU_avg': ecovacs_abs_acc['CU_avg'], 'abs_RU_avg': ecovacs_abs_acc['RU_avg'],
                       'abs_LC_avg': ecovacs_abs_acc['LC_avg'], 'abs_CC_avg': ecovacs_abs_acc['CC_avg'],
                       'abs_RC_avg': ecovacs_abs_acc['RC_avg'], 'abs_LD_avg': ecovacs_abs_acc['LD_avg'],
                       'abs_CD_avg': ecovacs_abs_acc['CD_avg'], 'abs_RD_avg': ecovacs_abs_acc['RD_avg'],
                       'abs_LU_min': ecovacs_abs_acc['LU_min'], 'abs_CU_min': ecovacs_abs_acc['CU_min'],
                       'abs_RU_min': ecovacs_abs_acc['RU_min'], 'abs_LC_min': ecovacs_abs_acc['LC_min'],
                       'abs_CC_min': ecovacs_abs_acc['CC_min'], 'abs_RC_min': ecovacs_abs_acc['RC_min'],
                       'abs_LD_min': ecovacs_abs_acc['LD_min'], 'abs_CD_min': ecovacs_abs_acc['CD_min'],
                       'abs_RD_min': ecovacs_abs_acc['RD_min'], 'abs_LU_max': ecovacs_abs_acc['LU_max'],
                       'abs_CU_max': ecovacs_abs_acc['CU_max'], 'abs_RU_max': ecovacs_abs_acc['RU_max'],
                       'abs_LC_max': ecovacs_abs_acc['LC_max'], 'abs_CC_max': ecovacs_abs_acc['CC_max'],
                       'abs_RC_max': ecovacs_abs_acc['RC_max'], 'abs_LD_max': ecovacs_abs_acc['LD_max'],
                       'abs_CD_max': ecovacs_abs_acc['CD_max'], 'abs_RD_max': ecovacs_abs_acc['RD_max'],
                       'abs_LU_std': ecovacs_abs_acc['LU_std'], 'abs_CU_std': ecovacs_abs_acc['CU_std'],
                       'abs_RU_std': ecovacs_abs_acc['RU_std'], 'abs_LC_std': ecovacs_abs_acc['LC_std'],
                       'abs_CC_std': ecovacs_abs_acc['CC_std'], 'abs_RC_std': ecovacs_abs_acc['RC_std'],
                       'abs_LD_std': ecovacs_abs_acc['LD_std'], 'abs_CD_std': ecovacs_abs_acc['CD_std'],
                       'abs_RD_std': ecovacs_abs_acc['RD_std'], 'abs_LU_var': ecovacs_abs_acc['LU_var'],
                       'abs_CU_var': ecovacs_abs_acc['CU_var'], 'abs_RU_var': ecovacs_abs_acc['RU_var'],
                       'abs_LC_var': ecovacs_abs_acc['LC_var'], 'abs_CC_var': ecovacs_abs_acc['CC_var'],
                       'abs_RC_var': ecovacs_abs_acc['RC_var'], 'abs_LD_var': ecovacs_abs_acc['LD_var'],
                       'abs_CD_var': ecovacs_abs_acc['CD_var'], 'abs_RD_var': ecovacs_abs_acc['RD_var'],
                       'rel_LU_avg': ecovacs_rel_acc['LU_avg'], 'rel_CU_avg': ecovacs_rel_acc['CU_avg'],
                       'rel_RU_avg': ecovacs_rel_acc['RU_avg'], 'rel_LC_avg': ecovacs_rel_acc['LC_avg'],
                       'rel_CC_avg': ecovacs_rel_acc['CC_avg'], 'rel_RC_avg': ecovacs_rel_acc['RC_avg'],
                       'rel_LD_avg': ecovacs_rel_acc['LD_avg'], 'rel_CD_avg': ecovacs_rel_acc['CD_avg'],
                       'rel_RD_avg': ecovacs_rel_acc['RD_avg'], 'rel_LU_min': ecovacs_rel_acc['LU_min'],
                       'rel_CU_min': ecovacs_rel_acc['CU_min'], 'rel_RU_min': ecovacs_rel_acc['RU_min'],
                       'rel_LC_min': ecovacs_rel_acc['LC_min'], 'rel_CC_min': ecovacs_rel_acc['CC_min'],
                       'rel_RC_min': ecovacs_rel_acc['RC_min'], 'rel_LD_min': ecovacs_rel_acc['LD_min'],
                       'rel_CD_min': ecovacs_rel_acc['CD_min'], 'rel_RD_min': ecovacs_rel_acc['RD_min'],
                       'rel_LU_max': ecovacs_rel_acc['LU_max'], 'rel_CU_max': ecovacs_rel_acc['CU_max'],
                       'rel_RU_max': ecovacs_rel_acc['RU_max'], 'rel_LC_max': ecovacs_rel_acc['LC_max'],
                       'rel_CC_max': ecovacs_rel_acc['CC_max'], 'rel_RC_max': ecovacs_rel_acc['RC_max'],
                       'rel_LD_max': ecovacs_rel_acc['LD_max'], 'rel_CD_max': ecovacs_rel_acc['CD_max'],
                       'rel_RD_max': ecovacs_rel_acc['RD_max'], 'rel_LU_std': ecovacs_rel_acc['LU_std'],
                       'rel_CU_std': ecovacs_rel_acc['CU_std'], 'rel_RU_std': ecovacs_rel_acc['RU_std'],
                       'rel_LC_std': ecovacs_rel_acc['LC_std'], 'rel_CC_std': ecovacs_rel_acc['CC_std'],
                       'rel_RC_std': ecovacs_rel_acc['RC_std'], 'rel_LD_std': ecovacs_rel_acc['LD_std'],
                       'rel_CD_std': ecovacs_rel_acc['CD_std'], 'rel_RD_std': ecovacs_rel_acc['RD_std'],
                       'rel_LU_var': ecovacs_rel_acc['LU_var'], 'rel_CU_var': ecovacs_rel_acc['CU_var'],
                       'rel_RU_var': ecovacs_rel_acc['RU_var'], 'rel_LC_var': ecovacs_rel_acc['LC_var'],
                       'rel_CC_var': ecovacs_rel_acc['CC_var'], 'rel_RC_var': ecovacs_rel_acc['RC_var'],
                       'rel_LD_var': ecovacs_rel_acc['LD_var'], 'rel_CD_var': ecovacs_rel_acc['CD_var'],
                       'rel_RD_var': ecovacs_rel_acc['RD_var']}
        all_result_dict[measured_distance - measureDelta] = result_dict

    headers = ['distance', 'hole_rate', 'outlier_percent',
               'rmse_roi_c', 'rmse_roi_l', 'rmse_roi_r', 'rmse_roi_t', 'rmse_roi_b', 'rmse_roi_25', 'rmse_roi_81', 'rmse_roi_cen',
               'abs_avg_roi_c', 'abs_avg_roi_l', 'abs_avg_roi_r', 'abs_avg_roi_t', 'abs_avg_roi_b', 'abs_avg_roi_25', 'abs_avg_roi_81', 'abs_avg_roi_cen',
               'abs_min_roi_c', 'abs_min_roi_l', 'abs_min_roi_r', 'abs_min_roi_t', 'abs_min_roi_b', 'abs_min_roi_25', 'abs_min_roi_81', 'abs_min_roi_cen',
               'abs_max_roi_c', 'abs_max_roi_l', 'abs_max_roi_r', 'abs_max_roi_t', 'abs_max_roi_b', 'abs_max_roi_25', 'abs_max_roi_81', 'abs_max_roi_cen',
               'abs_std_roi_c', 'abs_std_roi_l', 'abs_std_roi_r', 'abs_std_roi_t', 'abs_std_roi_b', 'abs_std_roi_25', 'abs_std_roi_81', 'abs_std_roi_cen',
               'abs_var_roi_c', 'abs_var_roi_l', 'abs_var_roi_r', 'abs_var_roi_t', 'abs_var_roi_b', 'abs_var_roi_25', 'abs_var_roi_81', 'abs_var_roi_cen',
               'rel_fov_h_val', 'rel_fov_h_max', 'rel_fov_h_min', 'rel_fov_h_cen', 'rel_fov_v_val', 'rel_fov_v_max', 'rel_fov_v_min', 'rel_fov_v_cen',
               'rel_avg_roi_25', 'rel_avg_roi_81', 'rel_avg_roi_cen',
               'rel_min_roi_25', 'rel_min_roi_81', 'rel_min_roi_cen',
               'rel_max_roi_25', 'rel_max_roi_81', 'rel_max_roi_cen',
               'rel_std_roi_25', 'rel_std_roi_81', 'rel_std_roi_cen',
               'rel_var_roi_25', 'rel_var_roi_81', 'rel_var_roi_cen',
               'rel_avg_per_roi_25', 'rel_avg_per_roi_81', 'rel_avg_per_roi_cen',
               'rel_min_per_roi_25', 'rel_min_per_roi_81', 'rel_min_per_roi_cen',
               'rel_max_per_roi_25', 'rel_max_per_roi_81', 'rel_max_per_roi_cen',
               'rel_std_per_roi_25', 'rel_std_per_roi_81', 'rel_std_per_roi_cen',
               'rel_var_per_roi_25', 'rel_var_per_roi_81', 'rel_var_per_roi_cen',
               'abs_LU_avg', 'abs_CU_avg', 'abs_RU_avg', 'abs_LC_avg', 'abs_CC_avg', 'abs_RC_avg', 'abs_LD_avg', 'abs_CD_avg', 'abs_RD_avg',
               'abs_LU_min', 'abs_CU_min', 'abs_RU_min', 'abs_LC_min', 'abs_CC_min', 'abs_RC_min', 'abs_LD_min', 'abs_CD_min', 'abs_RD_min',
               'abs_LU_max', 'abs_CU_max', 'abs_RU_max', 'abs_LC_max', 'abs_CC_max', 'abs_RC_max', 'abs_LD_max', 'abs_CD_max', 'abs_RD_max',
               'abs_LU_std', 'abs_CU_std', 'abs_RU_std', 'abs_LC_std', 'abs_CC_std', 'abs_RC_std', 'abs_LD_std', 'abs_CD_std', 'abs_RD_std',
               'abs_LU_var', 'abs_CU_var', 'abs_RU_var', 'abs_LC_var', 'abs_CC_var', 'abs_RC_var', 'abs_LD_var', 'abs_CD_var', 'abs_RD_var',
               'rel_LU_avg', 'rel_CU_avg', 'rel_RU_avg', 'rel_LC_avg', 'rel_CC_avg', 'rel_RC_avg', 'rel_LD_avg', 'rel_CD_avg', 'rel_RD_avg',
               'rel_LU_min', 'rel_CU_min', 'rel_RU_min', 'rel_LC_min', 'rel_CC_min', 'rel_RC_min', 'rel_LD_min', 'rel_CD_min', 'rel_RD_min',
               'rel_LU_max', 'rel_CU_max', 'rel_RU_max', 'rel_LC_max', 'rel_CC_max', 'rel_RC_max', 'rel_LD_max', 'rel_CD_max', 'rel_RD_max',
               'rel_LU_std', 'rel_CU_std', 'rel_RU_std', 'rel_LC_std', 'rel_CC_std', 'rel_RC_std', 'rel_LD_std', 'rel_CD_std', 'rel_RD_std',
               'rel_LU_var', 'rel_CU_var', 'rel_RU_var', 'rel_LC_var', 'rel_CC_var', 'rel_RC_var', 'rel_LD_var', 'rel_CD_var', 'rel_RD_var']

    Utils().saveDictToCsv(all_result_dict, csv_file_name, headers)


if __name__ == '__main__':
    """--------------------------------------------------------------------------------------------------------"""
    dir_name = ""
    alg_version = "ob_gemini335"

    # 注意这里选择真实的视差图像的分辨率，这里会根据视差情况重新计算 fx fy cx cy
    disp_img_w = 1280
    disp_img_h = 800

    """--------------------------------------------------------------------------------------------------------"""

    json_file_path = "/home/dataset_b/rmslTestDataset/orbbec/gemini335-01/v0619/rgb1920x1080_ir1280x800.json"
    if dir_name == "" or len(dir_name) == 0:
        test_dir = "/home/dataset_b/rmslTestDataset/orbbec/gemini335-01/v0619/r1920x1080_d1280x800/precision/normal-precision-new/"
    else:
        test_dir = f"/home/dataset_b/rmslTestDataset/orbbec/gemini335-01/v0619/r1920x1080_d1280x800/{dir_name}/precision/normal-precision-new/"

    csv_file_name = f"/home/dataset_b/rmslTestDataset/orbbec/gemini335-01/v0619/{alg_version}_rk3588_float_precision_result.csv"

    """--------------------------------------------------------------------------------------------------------"""

    """
        [Note]: Need to alter!
            [01] 快速精度数据集地址
            [02] 模组对应测试集分辨率对应的内外参以及旋转矩阵和平移系数对应的参数json
            [03] 测试的快速精度子类别
            [04] rk生成的深度需要修改关键字为 '_xxx_depth_' 后缀保持和默认一致
    """
    camera_param, depth_image_path_list = preprocess(json_file_path, test_dir, disp_img_w, disp_img_h, key='_depth_', en_disp=False)
    cal_precision(depth_image_path_list, camera_param, csv_file_name)
